home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / ATL_Samples / polygon / polygon.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  2.3 KB  |  84 lines

  1. // Polygon.cpp : Implementation of DLL Exports.
  2.  
  3. // You will need the NT SUR Beta 2 SDK or VC 4.2 or higher in order to build 
  4. // this project.  This is because you will need MIDL 3.00.15 or higher and new
  5. // headers and libs.  If you have VC 4.2 installed, then everything should
  6. // already be configured correctly.
  7.  
  8. // Note: Proxy/Stub Information
  9. //        To build a separate proxy/stub DLL, 
  10. //        run nmake -f Polygonps.mak in the project directory.
  11.  
  12. #include "stdafx.h"
  13. #include "resource.h"
  14. #include "Polygon.h"
  15.  
  16. #include "Polygon_i.c"
  17. #include "PolyCtl.h"
  18. #include "PolyProp.h"
  19.  
  20.  
  21. CComModule _Module;
  22.  
  23. BEGIN_OBJECT_MAP(ObjectMap)
  24.     OBJECT_ENTRY(CLSID_PolyCtl, CPolyCtl)
  25.     OBJECT_ENTRY(CLSID_PolyProp, CPolyProp)
  26. END_OBJECT_MAP()
  27.  
  28. /////////////////////////////////////////////////////////////////////////////
  29. // DLL Entry Point
  30.  
  31. extern "C"
  32. BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  33. {
  34.     if (dwReason == DLL_PROCESS_ATTACH)
  35.     {
  36.         _Module.Init(ObjectMap, (HINSTANCE)hInstance);
  37. #ifndef UNDER_CE
  38.         DisableThreadLibraryCalls((HINSTANCE)hInstance);
  39. #endif
  40.     }
  41.     else if (dwReason == DLL_PROCESS_DETACH)
  42.         _Module.Term();
  43.     return TRUE;    // ok
  44. }
  45.  
  46. /////////////////////////////////////////////////////////////////////////////
  47. // Used to determine whether the DLL can be unloaded by OLE
  48.  
  49. STDAPI DllCanUnloadNow(void)
  50. {
  51.     return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  52. }
  53.  
  54. /////////////////////////////////////////////////////////////////////////////
  55. // Returns a class factory to create an object of the requested type
  56.  
  57. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  58. {
  59.     return _Module.GetClassObject(rclsid, riid, ppv);
  60. }
  61.  
  62. /////////////////////////////////////////////////////////////////////////////
  63. // DllRegisterServer - Adds entries to the system registry
  64.  
  65. STDAPI DllRegisterServer(void)
  66. {
  67.     // registers object, typelib and all interfaces in typelib
  68.     return _Module.RegisterServer(TRUE);
  69. }
  70.  
  71. /////////////////////////////////////////////////////////////////////////////
  72. // DllUnregisterServer - Removes entries from the system registry
  73.  
  74. STDAPI DllUnregisterServer(void)
  75. {
  76.     _Module.UnregisterServer();
  77. #if _WIN32_WINNT >= 0x0400
  78.     //UnRegisterTypeLib(LIBID_POLYGONLib, 1, 0, LOCALE_USER_DEFAULT, SYS_WIN32);
  79. #endif
  80.     return S_OK;
  81. }
  82.  
  83.  
  84.